<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/15
 * Time: 13:29
 */
defined('ROOT_PATH') or define('ROOT_PATH',dirname(__DIR__));

//生成测试数组
function makeBaseArray(){
    $file = ROOT_PATH.'/base/array.txt';
    if(is_file($file)){     //如果文件存在，不重新生成数组
        $F = fopen($file,'r');
        $content = fread($F,filesize($file));
        fclose($F);
        $arr = unserialize($content);
        return $arr;
    }
    $arr1 = range(1,10000,1);
    $arr2 = range(1,10000,33);
    //生成数组
    $arr = array_merge($arr1,$arr2);
    shuffle($arr);      //打乱数组
    $arr = array_slice($arr,0,3000);
    $fp = fopen($file,'wx');
    fwrite($fp,serialize($arr));
    fclose($fp);
    return $arr;

}

















